package com.xuyixuan.shardingsphere_study;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

// OrderMapper接口
@Mapper
public interface OrderMapper {
    @Insert("INSERT INTO t_order(order_id, user_id, order_amount, order_time, status) " +
            "VALUES(#{orderId}, #{userId}, #{orderAmount}, #{orderTime}, #{status})")
    int insert(Order order);

    @Select("SELECT * FROM t_order WHERE user_id = #{userId}")
    List<Order> selectByUserId(@Param("userId") Integer userId);
}
